from django.shortcuts import render
from story.models import *
from server.models import *


def index(request):
    try:
        # 获取最新2个宠安快讯文章推荐
        clinic_story_2 = Story.objects.get_story_by_type(1)[:2]
        # 获取最新4个科学爱宠文章推荐
        science_story_4 = Story.objects.get_story_by_type(2)[:4]
        # 获取最热3个项目
        hot_project_3 = HotProject.objects.get_hot_project_3()
    except:
        pass
    return render(request,"index/index.html",locals())
